<template>
    <div class="view3Receipt2">
        <!-- <div class="header">
            <x-icon type="ios-arrow-left" size="" class="icon-white" @click="$router.go(-1)"></x-icon>生成通知单
        </div> -->
        <div class="view3ReceiptBox2">
            <h2>
                <span>共计: {{total}} 条</span>
                <em>已选择: {{num}} 条</em>
            </h2>
            <div class="standard-wrap">
                <div v-for="(item,index) in  listArr2"
                    v-bind:key="index"
                    class="item-wrap">
                    <standardItem :item="item" :showChild="showChild" :selectStandard="selectStandard"></standardItem>
                </div>
            </div>
        </div>
        <myMenu @clickBack="back"></myMenu>
    </div>
</template>
<script>
import standardItem from './select'
import myMenu from '@/commonComponents/menu'
export default{
    components: {
        standardItem,
        myMenu
    },
    data () {
        return {
            show_p:false,
            demo1: false,
            commonList: [ '来测试下这个长度问题,你都想不到这个会是个BUg', 'Japan', 'America' ],
            labelPosition: '',
            checklist001:[],
            showContent001: false,
            listArr2:[],
            param:{
                allowPaging:true,
                business:'GetCheckWorkHiddenDangers',
                data:{
                    type:'',
                    id:'c4a59478-1bd7-4b55-bebd-37201ed4c84a'
                },
                pageIndex:0,
                pageSize:1000,
                tokenId:'D0853C0CE5A6A478F5C613B840394FC3',
                userId:'615123137'
            },
            total:0,
            num:0
        }
    },
    created(){
        var token =JSON.parse(window.localStorage.getItem('userInfo'))
        this.param.userId=token.userid
        this.param.data.type=this.$route.query.type
    },
    mounted(){
        this.dataArr()
    },
    methods : {
        back(){

       },
        showChild (deptId, item) {
            item.open = !item.open
        },
        selectStandard (item) {
            item.checked = !item.checked
            var arr = this.listArr2
            var parmas =[]
            for (var k of arr){
                for(var j of k.problemSummaries){
                    if(j.checked){
                        parmas.push(j.Id)
                    }
                }
            }
            this.num=parmas.length
            console.log(parmas.length)
        },
        // 页面数据
        dataArr(){
            this.$axiosAjax.getConfigJson(this.param).then((res)=>{
                    if (res.status){
                        var arr =res.data.data
                        var a =[]
                        for(var k of arr){
                            for(var j of k.problemSummaries){
                                a.push(j.No)
                                j.checked = false
                            }
                            k.open=false
                        }
                        this.total=a.length
                        this.listArr2=arr
                    }
                }
            )
        },
    }
}
</script>
<style lang="less" scope>
.view3Receipt2{
    width: 100%;
    height: 100%;
    background-color: #ebeef2;
    .header{
        width: 100%;
        height: 40px;
        line-height: 40px;
        text-align: center;
        position: relative;
        font-size: 18px;
        background: #2269ff;
        color: #fff;
        .vux-x-icon{
            fill:cornsilk;
            position: absolute;
            left: 0;
            top: 5px;
            width: 30px;
            height: 30px;
        }
    }
    .view3ReceiptBox2{
        height: 603px;
        width: 100%;
        background-color: #ebeef2;
        h2{
            height: 50px;
            line-height: 50px;
            padding: 0 10px;
            font-size: 18px;
            background-color: #fff;
            span{
                color: #2269ff;
                float: left;
            }
            em{
                color: #000;
                float: right;
            }
        }
        .affirm-wrap {
            position: fixed;
            z-index: 5;
            bottom: 0;
            left: 0;
            right: 0;
            background: #ebeef2;
        }
        .standard-name span{
            margin-left: 20px;
            font-size: 16px;
        }
        .iconfont{
            margin-left: 20px;
        }
        .item-wrap {
            // padding-left: 20px;
            background: #fff;
            position: relative;
            z-index: 2;
            margin-top: 5px;
        }
        .btn{
            margin: 20px;
            height: 40px;
            div{
                margin: 0 auto;
                width: 200px;
                height: 40px;
                line-height: 40px;
                text-align: center;
                color: #fff;
                background-color: #2269ff;
                border-radius: 10px;
                font-size: 20px;
            }
        }
    }
    .weui-actionsheet{
        top: 30%;
        // width: 90%;
        // left: 20px;
        background-color:rgba(0,0,0,0);
    }
    .weui-actionsheet__menu{
        margin: 0 auto;
        width: 80%;
        height: 200px;
        overflow-y: auto;
        line-height: 20px;
        border-radius: 10px;
    }
    .vux-actionsheet-menu-default{
        padding: 10px!important;
        text-align: left;
    }
}


</style>

